package com.chinasoft.ssm.mapper;

import com.chinasoft.ssm.pojo.Bike;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface BikeMapper {
    @Insert("insert into bike values(null,#{category},#{color},#{status},#{dayPrice}," +
            "#{monthPrice},#{count},#{description1},#{img})")
    Integer insert(Bike bike);

    @Delete("delete from bike where id = #{id} ")
    Integer delete(Integer id);

    @Update("update bike set category = #{category}," +
            "" +
            "" +
            "" +
            " count = #{count}," +
            " description1 = #{description1}," +
            " img = #{img}" +
            ", color = #{color}, status = #{status}, dayPrice = #{dayPrice} " +
            ", monthPrice = #{monthPrice} where id = #{id} ")
    Integer update(Bike bike);

    @Select("select * from bike")
    List<Bike> findAll();

    @Select("select * from bike where id = #{id} ")
    Bike findById(Integer id);
    @Select("select * from bike where category = #{category} ")
    List<Bike> findBycatId(String  id);
    @Select("select * from bike order by count desc limit 15")
    List<Bike> select15();

    List<Bike> selectByDSql(Bike bike);

   List<Bike> selectByDSql1(Bike bike);
}
